package com.landian.commons.jpa.builder;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;

/**
 * @author caojl
 */
public class PageRequestBuilder {

    public static PageRequest newInstance(int page, int size){
        return new PageRequest(page,size);
    }

    public static PageRequest newInstance(int page, int size, Sort.Direction direction, String... properties){
        return new PageRequest(page,size,direction,properties);
    }

    public static PageRequest newInstance(int page, int size, String direction, String... properties){
        return new PageRequest(page,size,Sort.Direction.fromString(direction),properties);
    }

    public static PageRequest newInstance(int page, int size, Sort sort){
        return new PageRequest(page,size,sort);
    }
}
